Telegram Group & Telegram Channel
✏️ Промпт дня: Следуй стандартам кода в C++

Если необходимо быстро привести код к определённому стилю, то этом случае можно воспользоваться следующим промптом.


🍴 Промпт для AI-помощника:

Rewrite the code below following the Google style guidelines for C++.

[Вставь свой код]



‼️ Пример использования промпта:

Было:

class userManager{
public:
int getUserCount(){return userCount;}
void setUserCount(int count){userCount=count;}
private:
int userCount;
};

void ProcessUserData(){
const int maxUsers=100;
userManager um;
for(int i=0;i<maxUsers;i++){
um.setUserCount(i);
}
}


Стало (после применения Google C++ Style Guide):

class UserManager {
public:
int GetUserCount() const { return user_count_; }
void SetUserCount(int count) { user_count_ = count; }

private:
int user_count_;
};

void ProcessUserData() {
const int MAX_USERS = 100;
UserManager user_manager;

for (int i = 0; i < MAX_USERS; ++i) {
user_manager.SetUserCount(i);
}
}


Что изменилось:

Функции в CamelCase
Переменные в snake_case
Константы в UPPER_CASE
Правильные отступы и пробелы


⛄️ А каким стилем для кода вы пользуетесь? Пишите в комментариях.

Библиотека C/C++ разработчика #буст
Please open Telegram to view this post
VIEW IN TELEGRAM



tg-me.com/cppproglib/5784
Create:
Last Update:

✏️ Промпт дня: Следуй стандартам кода в C++

Если необходимо быстро привести код к определённому стилю, то этом случае можно воспользоваться следующим промптом.


🍴 Промпт для AI-помощника:

Rewrite the code below following the Google style guidelines for C++.

[Вставь свой код]



‼️ Пример использования промпта:

Было:

class userManager{
public:
int getUserCount(){return userCount;}
void setUserCount(int count){userCount=count;}
private:
int userCount;
};

void ProcessUserData(){
const int maxUsers=100;
userManager um;
for(int i=0;i<maxUsers;i++){
um.setUserCount(i);
}
}


Стало (после применения Google C++ Style Guide):

class UserManager {
public:
int GetUserCount() const { return user_count_; }
void SetUserCount(int count) { user_count_ = count; }

private:
int user_count_;
};

void ProcessUserData() {
const int MAX_USERS = 100;
UserManager user_manager;

for (int i = 0; i < MAX_USERS; ++i) {
user_manager.SetUserCount(i);
}
}


Что изменилось:

Функции в CamelCase
Переменные в snake_case
Константы в UPPER_CASE
Правильные отступы и пробелы


⛄️ А каким стилем для кода вы пользуетесь? Пишите в комментариях.

Библиотека C/C++ разработчика #буст

BY Библиотека C/C++ разработчика | cpp, boost, qt


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/cppproglib/5784

View MORE
Open in Telegram


Библиотека C C разработчика | cpp boost qt Telegram | DID YOU KNOW?

Date: |

A Telegram spokesman declined to comment on the bond issue or the amount of the debt the company has due. The spokesman said Telegram’s equipment and bandwidth costs are growing because it has consistently posted more than 40% year-to-year growth in users.

Telegram auto-delete message, expiring invites, and more

elegram is updating its messaging app with options for auto-deleting messages, expiring invite links, and new unlimited groups, the company shared in a blog post. Much like Signal, Telegram received a burst of new users in the confusion over WhatsApp’s privacy policy and now the company is adopting features that were already part of its competitors’ apps, features which offer more security and privacy. Auto-deleting messages were already possible in Telegram’s encrypted Secret Chats, but this new update for iOS and Android adds the option to make messages disappear in any kind of chat. Auto-delete can be enabled inside of chats, and set to delete either 24 hours or seven days after messages are sent. Auto-delete won’t remove every message though; if a message was sent before the feature was turned on, it’ll stick around. Telegram’s competitors have had similar features: WhatsApp introduced a feature in 2020 and Signal has had disappearing messages since at least 2016.

Библиотека C C разработчика | cpp boost qt from ye


Telegram Библиотека C/C++ разработчика | cpp, boost, qt
FROM USA